<%@ page language="java" import="java.util.*"  pageEncoding="utf-8"%>
<%-- <%@include file="common/zTreeHead.jsp" %> --%>
<link rel="stylesheet" href="${pageContext.request.contextPath}/mystyle/zTreeStyle/css/demo.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/mystyle/zTreeStyle/css/zTreeStyle.css" type="text/css">
<script src="${pageContext.request.contextPath}/assets/vendor/jquery/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath}/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/mystyle/zTreeStyle/js/jquery.ztree.core.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/mystyle/zTreeStyle/js/jquery.ztree.excheck.js"></script>
<html>
  <head>
    <title>地址树</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<SCRIPT type="text/javascript">
		<!--
		var setting = {
			data: {
				simpleData: {
					enable: true
				}
			},
			check :{
				radioType : "all",
				enable: true,
				chkStyle: "radio"
			}
		};

		var json = ${warehousetree};
        var zNodes = eval(json);
		/* [
			{ id:1, pId:0, name:"父节点1 - 展开", open:true},
			{ id:11, pId:1, name:"父节点11 - 折叠"},
			{ id:111, pId:11, name:"叶子节点111"},
			{ id:112, pId:11, name:"叶子节点112"},
			{ id:113, pId:11, name:"叶子节点113"},
			{ id:114, pId:11, name:"叶子节点114"},
			{ id:12, pId:1, name:"父节点12 - 折叠"},
			{ id:13, pId:1, name:"父节点13 - 没有子节点", isParent:true},
			{ id:2, pId:0, name:"父节点2 - 折叠"},
			{ id:21, pId:2, name:"父节点21 - 展开", open:true},
			{ id:221, pId:22, name:"叶子节点221",onclick:"alert(1)"},
			{ id:23, pId:2, name:"父节点23 - 折叠"},
			{ id:3, pId:0, name:"父节点3 - 没有子节点", isParent:true}
		]; */

		$(document).ready(function(){
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			$("#okeyclick").click(function(){
				var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
				if(treeObj.getCheckedNodes().length!=0){
					var checkId = treeObj.getCheckedNodes()[0];
					window.parent.yongan.dialog.addgys(checkId);
					//alert(checkId);
				}else{
					alert("请选择用户！");
				}
				
			});
			$("#unokeyclick").click(function(){
				window.parent.yongan.dialog.closedialog("deptdialog");
			});
		});
		//-->
		
	</SCRIPT>
  </head>
  <body>
   <div class="zTreeDemoBackground" style="float:left">
		<ul id="treeDemo" class="ztree"></ul>
	</div>
	<div id="okeyclick"><a class="btn btn-info">确定</a></div>
	<div id="unokeyclick"><a class="btn btn-info">取消</a></div>
  </body>
</html>
